package com.diy.sigmund.diycommon.designpatterns.factorymethod.pizza2;

/**
 * @author ylm-sigmund
 * @since 2022/2/8 14:59
 */
public class ClamPizza extends Pizza {

    PizzaIngredientFactory pizzaIngredientFactory;

    public ClamPizza(PizzaIngredientFactory pizzaIngredientFactory) {
        this.pizzaIngredientFactory = pizzaIngredientFactory;
    }

    /**
     * 要做出蛤蜊pizza，就必须从本地工厂中取得正确的原料
     */
    @Override
    void prepare() {
        System.out.println("Prepareing" + name);
        dough = pizzaIngredientFactory.createDough();
        sauce = pizzaIngredientFactory.createSauce();
        cheese = pizzaIngredientFactory.createCheese();
        // 如果是纽约工厂，就会使用新鲜的蛤蜊，如果是芝加哥工厂，就是冷冻的蛤蜊
        clams = pizzaIngredientFactory.createClams();
    }
}
